import request from "@/request/request";
import requestMock from "@/request/requestMock";
// 1- 获取三级列表数据
export const reqGetCategotyList = () => {
	return request.get('/product/getBaseCategoryList')
}

// 2- 获取轮播图图片
export const reqGetBannerList = () => {
	return requestMock.get('/home/banner')
}

// 3- 获取floor的数据
export const reqGetFloorList = () => {
	return requestMock.get('/home/floor')
}

// 4- 获取Search页搜索数据
export const reqGetSearchList = (searchUrl) => {
	return request.post('/list', searchUrl)
}

// 5- 获取Search页搜索数据
export const reqGetSearchDetails = (skuId) => {
	return request.get(`/item/${skuId}`,)
}

// 6- 添加到购物车对购物车已有商品数量的修改
export const reqPostAddToCart = (skuId, skuNum) => {
	return request.post(`/cart/addToCart/${skuId}/${skuNum}`,)
}

// 7- 添请求购物车的初始数据
export const reqGetCartList = () => {
	return request.get('/cart/cartList')
}

// 8- 修改单个选中状态
export const reqGetcheckCart = (skuID, isChecked) => {
	return request.get(`/cart/checkCart/${skuID}/${isChecked}`)
}

// 9- 删除单个购物车列表的数据
export const reqDeleteCart = (skuId) => {
	return request.delete(`/cart/deleteCart/${skuId}`)
}

// 10- 批量选中购物车
export const reqPostCheckedAll = (isChecked, skuIdList) => {
	return request.post(`/cart/batchCheckCart/${isChecked}`, skuIdList);
}

// 11- 删除所有购物车已选中的商品
export const reqDeleteCheckedAll = (skuIdList) => {
	return request.delete(`/api/cart/batchDeleteCart`, {
		data: skuIdList
	});
}

// 12- 获取验证码
export const reqGetSendCode = (phone) => {
	return request.get(`/user/passport/sendCode/${phone}`)
}

// 13- 注册用户
export const reqPostRegister = (userInfo) => {
	return request.post(`/user/passport/register`, userInfo)
}
// 14- 登录
export const reqPostLogin = (userInfo) => {
	return request.post(`/user/passport/login`, userInfo)
}
// 15- 请求用户信息（需要携带token）
export const reqGetUserInfo = () => {
	return request.get(`/user/passport/auth/getUserInfo`)
}
// 16- 退出登录并是token过期
export const reqGetLogout = () => {
	return request.get(`/user/passport/logout`)
}
// 17- 请求用户提交订单的地址的mock数据
export const reqGetUserAddress = () => {
	return requestMock.get(`/user/userAddress/auth/findUserAddressList`)
}
// 18- 请求交易页数据信息
export const reqGetTradeInfo = () => {
	return request.get(`/order/auth/trade`);
}
// 19- 提交订单
export const reqPostSubmitOrder = (tradeNo, OrderInfo) => {
	return request.post(`/order/auth/submitOrder?tradeNo=${tradeNo}`, OrderInfo);
}
// 20- 获取订单支付信息
export const reqGetCreateNative = (orderId) => {
	return request.get(`/payment/weixin/createNative/${orderId}`);
}
// 21- 查看订单的支付状态
export const reqGetPayStatus = (orderId) => {
	return request.get(`/payment/weixin/queryPayStatus/${orderId}`);
}
//22.获取订单的分页列表
export const reqGetOrderList = ({page, limit}) => {
	return request.get(`/order/auth/${page}/${limit}`)
}